﻿using System;
using Com.PhilChuang.Mobile.Apps.LocationSender.Model.Data;
using Com.PhilChuang.Mobile.Apps.LocationSender.Ui.Views.Impl.ViewModels;
using Com.PhilChuang.Pmvp.Ui.Views.Impl.Pages;
using Com.PhilChuang.Pmvp.Ui.Views.Impl.ViewFacades;

namespace Com.PhilChuang.Mobile.Apps.LocationSender.Ui.Views.Impl.ViewFacades
{
	public abstract class AbstractLocationSenderAppViewFacade<TPage, TPageModel> : AbstractViewFacade<TPage, TPageModel>, ILocationSenderView
		where TPage : PageBase<TPageModel>
		where TPageModel : AbstractLocationSenderAppViewModel
	{
		#region Properties
		public String AppStatus
		{
			get { return myViewModel.AppStatus; }
			set
			{
				if (DoNotAccessViewModel ()) return;
				InvokeSet (val => {
				           	if (DoNotAccessViewModel ()) return;
				           	myViewModel.HasBeenLoaded = true;
				           	myViewModel.AppStatus = val;
				           },
				           value);
			}
		}

		public GeoCoordinate CurrentPosition
		{
			get { return myViewModel.CurrentPosition; }
			set
			{
				if (DoNotAccessViewModel ()) return;
				InvokeSet (val => {
				           	if (DoNotAccessViewModel ()) return;
				           	myViewModel.HasBeenLoaded = true;
				           	myViewModel.CurrentPosition = val;
				           },
				           value);
			}
		}
		#endregion

		#region Constructors
		protected AbstractLocationSenderAppViewFacade ()
		{
		}

		protected AbstractLocationSenderAppViewFacade (TPage page)
		{
			myPage = page;
		}
		#endregion
	}
}
